1. /* scfsinbs.cpp by K.Tsuru */
  2. // function ID = 9122 since ver.2.18
  3. /*****************************************
  4. SComplex class
  5. It returns cos(z) using binary splitting method.
  6. Let z = x+iy,
  7. sin(z) = sin(x)*cosh(y)+i*cos(x)sinh(y).
  8. *****************************************/
  9. #ifndef SN_H
  10. #include "sn.h"
  11. #endif
  12. SComplex CsinBS(const SComplex& z){
  13. SDouble c, s, ch, sh;
  14. CosSinBS(z.Real(), c, s); // c = cos(x), s = sin(x)
  15. SDouble e, r;
  16. int is = z.Imag().Sign(9122);
  17. if(is > 0) { // y > 0
  18. e = ExpBS(z.Imag()); // = exp(y)
  19. r = 1/e;
  20. ch = DDiv2(e + r); // = cosh(y)
  21. sh = ch - r; // = sinh(y)
  22. } else if(is == 0) { // y = 0
  23. ch = 1; sh = 0.0;
  24. } else { // y < 0
  25. e = ExpBS(-z.Imag()); // = exp(-y)
  26. r = 1/e;
  27. ch = DDiv2(e + r); // = cosh(-y)
  28. sh = ch - e; // = -sinh(-y)
  29. }
  30. return SComplex(s * ch, c * sh);
  31. }

scfsinbs.cpp : last modifiled at 2008/12/08 16:22:14(862 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).